/**
 * 
 */
package com.googlecode.pcapj;

import java.util.Calendar;

/**
 *  
 */
public class TimeStamp {
	private int second;
	private int microSecond;
	
	
	/**
	 * 
	 */
	public TimeStamp() {
		super();
	}
	/**
	 * @param second
	 * @param microSecond
	 */
	public TimeStamp(int second, int microSecond) {
		super();
		this.second = second;
		this.microSecond = microSecond;
	}
	/**
	 * @return the second
	 */
	public int getSecond() {
		return second;
	}
	/**
	 * @param second the second to set
	 */
	public void setSecond(int second) {
		this.second = second;
	}
	/**
	 * @return the microSecond
	 */
	public int getMicroSecond() {
		return microSecond;
	}
	/**
	 * @param microSecond the microSecond to set
	 */
	public void setMicroSecond(int microSecond) {
		this.microSecond = microSecond;
	}
	public long toMilliSecond(){
    	long second = (0x00000000ffffffffL & this.second) * 1000;
    	long microSecond = ((long)this.microSecond) / 1000;
    	return second + microSecond;		
	}
	public Calendar toCalendar(){
		Calendar calendar = Calendar.getInstance();
		calendar.setTimeInMillis(toMilliSecond());
		return calendar; 
	}
}
